<!--
  Created by IntelliJ IDEA.
  User: Dai
  Date: 2018/4/13
  Time: 9:39
  Remark: 工程配置 -  对象管理 -  项目管理 - 编辑设备树 - 唯一标识
  To change this template use File | Settings | File Templates.
-->
<!--标题栏-->
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">唯一标识&nbsp;&gt;&nbsp;<span th:text="${equipmentManage.name}">???</span></h4>
</div>
<!--表格栏-->
<div class="modal-body">
    <div style="width: 100%;min-height: 100px;">
        <input type="hidden" th:value="${equipmentManage.id}" name="id" id="child_id">
        <div>
            <label style="margin-right: 10px">唯一标识</label>
            <input type="text" name="code" id="code" th:value="${equipmentManage.code}">
        </div>
    </div>
</div>
<!--按钮栏-->
<div class="modal-footer">
    <button type="button" class="btn btn-default" onclick="check_info(this)">确定</button>
</div>
<!--该页面的js 未完成部分见TODO -->
<script>
    /**
     * 检查填写的信息是否完整
     */
    function check_info(button) {
        var fd = new FormData();
        fd.append("id", $("#child_id").val());
        fd.append("code", $("#code").val());
        $.ajax({
            url: "save_equipment_code",
            type: "POST",
            processData: false,
            contentType: false,
            data: fd,
            success: function (result) {
                alert(result.message);
                if (result.message == "保存成功"){
                    $(button).parent().siblings(":first").find("button").click();
                    $("#dataTable").bootstrapTable("selectPage",1);
                }
            }
        });
    }
</script>